<template>
  <div id="div1" style="width: 50%">
    <img src="/images/f8.jpg" />&nbsp;&nbsp;
    <h2 id="h1">
      {{ planlist.film.name }}
      <p id="p1">
        类型:{{ planlist.film.type1 }}/喜剧/ <br />剧情简介: <br /><br /><span>
          {{ planlist.film.dra }}
        </span>
      </p>
    </h2>
    <br />
    <p id="p2">
      影院:{{ planlist.cinema.name }} <br />
      影厅:{{ planlist.room.name }}<br />
      观影时间:{{ planlist.time }} <br />票价:{{
        planlist.price
      }}
      合计:70元<br />
      <button id="btn1" @click="Buy()">确认购买</button>
    </p>

    <div id="right">
      <div id="ri">
        <div>可选</div>
        <div>已选</div>
        <div>已售</div>
      </div>
      <div id="seats" >
        <div
          :class="[
            item.statu == 0 ? 'seat' : item.statu == 1 ? 'seat2' : 'seat3',
          ]"
          v-for="(item, index) in seatlist"
          :key="index"
          @click="xuanze(item.no, item.pid, item.sid)"
        >
          {{ item.no }}
        </div>
      </div>
     
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "buy",
  data() {
    return {
      planlist: [],
      seatlist: [],
      
      xuanzhong: false,
      
    };
  },

  created() {
    this.planAxiosOne();
    this.seatAxiosOne();
  },
  methods: {
    planAxiosOne() {
      axios
        .get(
          "http://localhost:8888/planone/?id=" + sessionStorage.getItem("pid")
        )
        .then(({ data }) => {
          console.log(data);
          this.planlist = data;
        });
    },
    seatAxiosOne() {
      axios
        .get("http://localhost:8888/seat/?pid=" + sessionStorage.getItem("pid"))
        .then(({ data }) => {
          console.log(data);
          this.seatlist = data;
        });
    },
    // 买
    Buy() {
      this.$router.push({ path: "/index/ct" });
    },
    //选择
    xuanze(no, pid, sid) {
     
  },
  }
};
</script>

<style  scoped>
#div1 {
  display: flex;
}
#h1 {
  color: red;
}
#p1 {
  color: rgb(193, 173, 173);
  font-size: 60%;
  width: 450px;
}
#p2 {
  position: absolute;
  left: 5px;
  top: 500px;
  color: rgb(6, 0, 0);
}
#btn1 {
  background-color: red;
  width: 70%;
  border: none;
}
#box1 {
  display: flex;
  flex-wrap: wrap;
  width: 1500px;
}
.but1 {
  width: 30px;
  height: 20px;
}
.kx {
  background-color: #fff;
}
.yx {
  background-color: rgb(26, 157, 214);
}
.ys {
  background-color: rgb(242, 10, 10);
}

#ri {
  display: flex;
}
#ri div {
  margin-left: 80px;
  margin-top: 50px;
  padding: 5px;
  border-radius: 5px;
}
#ri div:hover {
  box-shadow: 1px 0px 2px 1px #aaaaaa;
}
#ri div:nth-of-type(1) {
  background-color: rgb(192, 225, 225);
}
#ri div:nth-of-type(2) {
  background-color: rgb(22, 143, 218);
}
#ri div:nth-of-type(3) {
  background-color: red;
}
#app {
  display: flex;
}
#seats {
  margin-left: 40px;
  /* margin-top:20px; */
  /* padding:5px; */
  display: flex;
  height: 300px;
  width: 400px;
  /* background-color:palegreen; */
  justify-content: left;
  flex-wrap: wrap;
  box-sizing: border-box;
  align-content: flex-start;
}
.seat {
  margin-left: 8px;
  width: 40px;
  box-sizing: border-box;
  margin-top: 20px;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 10px;
  border-radius: 5px;
  background-color: rgb(192, 225, 225);
}
.seat2 {
  margin-left: 8px;
  width: 40px;
  box-sizing: border-box;
  margin-top: 20px;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 10px;
  border-radius: 5px;
  background-color: rgb(22, 143, 218);
}
.seat3 {
  margin-left: 8px;
  width: 40px;
  box-sizing: border-box;
  margin-top: 20px;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 10px;
  border-radius: 5px;
  background-color: red;
  pointer-events: none;
  cursor: default;
}
</style>